package com.example.fang.demodruid.controller;

import com.example.fang.demodruid.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;

@Controller
@RequestMapping("/tpl")
public class ThymeleafController {
    @RequestMapping("/testThymeleaf")
    public String testThymeleaf(ModelMap model) {
        User user=new User();
        user.setName("zhangsan");
        user.setPhone("3423432");
        // 设置属性
        model.addAttribute("entity",user);
        // testThymeleaf：为模板文件的名称
        // 对应src/main/resources/templates/testThymeleaf.html
        return "testThymeleaf";
    }


    @RequestMapping("/index")
    public String index(){
        return "index";
    }


    @RequestMapping("/form0")
    public String form0(){
        return "form0";
    }

    @RequestMapping("/form")
    public String form(){
        return "form";
    }

    @RequestMapping("/form1")
    public String form1(){
        return "form2";
    }

    @RequestMapping("/form3")
    public String form3(){
        System.out.println("323232");
        return "form3";
    }


    @RequestMapping("/leftNavi")
    public String leftNavi(){
        System.out.println("323232");
        return "leftNavi";
    }
}
